var but = document.getElementsByTagName("button"),
    lis = document.getElementsByTagName("li"),
    luntu = document.getElementsByClassName("lun-tu")[0];
var ims = luntu.children;
//console.log(ims)
var ha = 0;
for (var i = 0; i < but.length; i++) {
    but[i].onclick = function () {
        if (this.innerText == ">") {
            ha++;
            ha == lis.length && (ha = 0);
            for (var i = 0; i < lis.length; i++) {
                lis[i].className = "";
                ims[i].className = "";
            }
            lis[ha].className = "active";
            ims[ha].className = "active";
        } else {
            ha--;
            ha == -1 && (ha = lis.length - 1);
            for (var i = 0; i < lis.length; i++) {
                lis[i].className = "";
                ims[i].className = "";
            }
            ims[ha].className = "active";
            lis[ha].className = "active";
        }
    }
}
for (var i in lis) {
    lis[i].onclick = function () {
        ha = this.getAttribute("luo");

        for (var i = 0; i < lis.length; i++) {
            lis[i].className = "";
            ims[i].className = "";
        }

        ims[ha].className = "active";
        lis[ha].className = "active";
    }
}

timer = setInterval(function () {
    ha++;
    ha == lis.length && (ha = 0);
    for (var i = 0; i < lis.length; i++) {
        // lis[i].onclick=function(){


        lis[i].className = "";
        ims[i].className = "";
    }
    lis[ha].className = "active";
    ims[ha].className = "active";
}, 1000)

lun.onmouseover = function () {
    clearInterval(timer)
}
lun.onmouseout = function () {
    timer = setInterval(function () {
        ha++;
        ha == lis.length && (ha = 0);
        for (var i = 0; i < lis.length; i++) {
            lis[i].className = "";
            ims[i].className = "";
        }
        lis[ha].className = "active";
        ims[ha].className = "active";
    }, 1000)
}
lun.onmouseover = function () {
    clearInterval(timer);
}

lun.onmouseout = function () {
    timer = setInterval(function () {
        ha++;
        ha == lis.length && (ha = 0);

        for (var i = 0; i < lis.length; i++) {
            lis[i].className = "";
            ims[i].className = "";
        }

        ims[ha].className = "active";
        lis[ha].className = "active";
    }, 1000)

}



// var ps = document.getElementById("pp");
// var divs = document.getElementById("xuan");
// console.log(ps)
// console.log(divs)
// for (var i = 0; i < ps.length; i++) {
//     console.log(1)

//     ps[i].onclick = function () {
//         console.log(ps[i])

//         for (var j = 0; j < divs.length; j++) {
//             ps[j].className = ""
//             divs[j].className = ""
//         }
//         var i = this.getAttribute("abc");
//         divs[i].className = "active"
//         this.className = "active"
//     }
//     console.log(this)
//     console.log(divs)
//     console.log(i)
// }


var ps = document.getElementById("pp");
var divs = document.getElementById("xuan");
var spas=ps.lastElementChild;
//console.log(spas)
//console.log(ps)
//console.log(divs)
    ps.onclick=function(){
        if(spas.innerHTML=="+"){
            spas.innerHTML="-"
            // console.log(spas)
            divs.style.display="none"
            // console.log(divs)
            
        }else{
            spas.innerHTML="+"
            //console.log(spas)
            divs.style.display="block"
            //console.log(divs)   
        }

        
    }




var l = document.getElementsByTagName("h4");
console.log(l)
var spa=l.lastElementChild;
var d = document.getElementsByTagName('h5');
console.log(d)
console.lo
for (var i = 0; i < l.length; i++) {
    l[i].onclick = function () {
        for (var i = 0; i < l.length; i++) {
            l[i].className = ''
            d[i].className = ''
           
        }
        var i = this.getAttribute('aaa');
        d[i].className = 'active'
        this.className = 'active'
        
    }  
}
